package com.walle.bio;

import java.io.*;
import java.net.Socket;

/**
 * @author zhangjiapeng
 * @Package com.walle.bio
 * @Description: ${todo}
 * @date 2019/1/18 14:07
 */
public class TimeClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",9999);

        PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()),true);
        writer.print("hallo ji dian la");
        writer.flush();
        socket.shutdownOutput();
        BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String buff = reader.readLine();
//        StringBuilder rtnBuilder =  new StringBuilder();
//        while (buff != null){
//            rtnBuilder.append(buff);
//            buff = reader.readLine();
//        }
        System.out.println(buff);
        reader.close();
        writer.close();
        reader = null;
        writer = null;
        socket.close();
    }
}
